/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.system;

import com.enation.app.javashop.client.system.SmsClient;
import com.enation.app.javashop.core.client.fallback.system.SmsClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.base.SceneType;
import com.enation.app.javashop.model.base.vo.SmsSendVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 发短信客户端
 *
 * @author zh
 * @version v7.0
 * @date 18/7/27 上午11:48
 * @since v7.0
 */
@FeignClient(value = "system-service",fallbackFactory = SmsClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface SmsClientFeignImpl extends SmsClient {
    /**
     * 验证手机验证码
     *
     * @param scene  业务场景
     * @param mobile 手机号码
     * @param code   手机验证码
     * @return 是否通过校验 true通过，false不通过
     */
    @Override
    @RequestMapping(value = "/client/sms/valid",method = RequestMethod.GET)
    boolean valid(@RequestParam("scene")String scene, @RequestParam("mobile")String mobile, @RequestParam("code")String code);


    /**
     * 发送(发送手机短信)消息
     *
     * @param byName    操作，替换内容
     * @param tel    手机号码
     * @param sceneType 操作类型
     */
    @Override
    @RequestMapping(value = "/client/sms/send-message",method = RequestMethod.POST)
    void sendSmsMessage(@RequestParam("by_name")String byName,@RequestParam("tel") String tel, @RequestParam("scene_type") SceneType sceneType);

    /**
     * 真实发送手机短信
     *
     * @param smsSendVO
     */
    @Override
    @RequestMapping(value = "/client/sms/send",method = RequestMethod.POST)
    void send(@RequestBody SmsSendVO smsSendVO);

    /**
     * 获取验证通过的手机号
     * @param scene
     * @param mobile
     * @return
     */
    @Override
    @RequestMapping(value = "/client/sms/valid-mobile",method = RequestMethod.POST)
    String validMobile(@RequestParam("scene")String scene, @RequestParam("mobile")String mobile);

}
